package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.ColdStorageTempProvider;
import com.jinmdz.fmis.mapper.entity.ColdStorageTempEntity;

import java.util.ArrayList;

/**
 * 冷藏临时出藏记录表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface ColdStorageTempMapper {

    /**
     * 增加ColdStorageTemp
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = ColdStorageTempProvider.class, method = "insertColdStorageTemp")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertColdStorageTemp(@Param("entity") ColdStorageTempEntity entity);

    /**
     * 删除ColdStorageTemp
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update cold_storage_temp set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForColdStorageTemp(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改ColdStorageTemp
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = ColdStorageTempProvider.class, method = "updateColdStorageTemp")
    void updateColdStorageTemp(@Param("entity") ColdStorageTempEntity entity);

    /**
     * 查询ColdStorageTemp实体
     * 
     * @param id 主键
     * @return ColdStorageTempEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,business_code,cold_storage_id,temp_whereabouts_code,temp_out_time,temp_return_time,as_returned,random_code,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from cold_storage_temp where id = #{id} and deleted = 0 limit 1 ")
    ColdStorageTempEntity getColdStorageTempById(@Param("id") Integer id);

    /**
     * 查询ColdStorageTemp列表
     * 
     * @param entity 数据实体
     * @return ColdStorageTempEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = ColdStorageTempProvider.class, method = "listColdStorageTemp")
    ArrayList<ColdStorageTempEntity> listColdStorageTemp(@Param("entity") ColdStorageTempEntity entity);
}